var noteForm = {
    subAjax : function() {
      var bv = $('#userInfoFrom').data('bootstrapValidator');
      bv.validate();
      if(bv.isValid()){
        var data = $('#userInfoFrom').serializeArray();
        var url = base+'/note/save.action';
        console.info(Calendar.clickDayTime);
        $.post(url,data,function(data,testStatus,jqXHR){
          console.info(data.data);
          if(data.data){
              var eventData;
              eventData = {
                  title: data.data.title,
                  start: data.data.start,
                  end: data.data.end,
                  allDay: data.data.allDay
              };
              Calendar.obj.fullCalendar('renderEvent', eventData, true); // stick? = true
              Calendar.obj.fullCalendar('unselect');
          }
          $("#noteModal").modal('hide');
        });
      };
    },
    data:function(){
      $('#userInfoFrom').serializeArray();
    }
  };
  $(document).ready(function() {
    var initStartDate,initEndDate = new Date();
    if(moment.isMoment(Calendar.clickDayTimeStart)){
      initStartDate = Calendar.clickDayTimeStart.toDate();
      // try new Date(Calendar.clickDayTimeStart.valueOf())
    }
    if(moment.isMoment(Calendar.clickDayTimeEnd)){
      initEndDate = Calendar.clickDayTimeEnd.toDate();
    }
    $('#noteModal').on('hidden.bs.modal', function (e) {
      $("#noteModal").remove();
    });
    var start = $("#start");
    var end = $("#end");
    start.datetimepicker({
        language : 'zh-CN',
        pickerPosition : 'bottom-left',
        startView : 1,
        minView : 0,
        autoclose : true,
        todayBtn : false,
        initialDate : initStartDate
    });
    end.datetimepicker({
        language : 'zh-CN',
        pickerPosition : 'bottom-left',
        startView : 1,
        minView : 0,
        autoclose : true,
        todayBtn : false,
        initialDate : initEndDate
    });
    var form = $("#userInfoFrom");
    form.on('init.form.bv', function(e, data) {
    }).bootstrapValidator({
      feedbackIcons : {
        valid : 'glyphicon glyphicon-ok',
        invalid : 'glyphicon glyphicon-remove',
        validating : 'glyphicon glyphicon-refresh'
      },
      fields : {
        title : {
          validators : {
            notEmpty : true,
            stringLength : {
                min : 2,
                max : 30
            }
          }
        }
      }
    }).on('success.form.bv', function(e) {
      e.preventDefault();
      console.info("success");
    });
  });